<template>
  <div style="font-size: 50rem">
    <div>Login</div>
    <input type="text" v-model="token" />
    <input type="button" value="登陆" @click="login" />
  </div>
</template>

<script>
export default {
  name: 'login',
  data() {
    return {
      token: ''
    }
  },
  methods: {
    async login() {
      if (this.token) {
        sessionStorage.setItem('token', this.token)
      } else {
        sessionStorage.removeItem('token')
      }
      let token = sessionStorage.getItem('token')
      if (token) {
        await this.xtPush('home')
      }
    }
  }
}
</script>